const request = {
	"url": "/api/test",
	"body": {
		"username": "admin",
		"password": "111111"
	},
	"query": {

	},
	"headers": {
		"host": "localhost:3000",
		"connection": "keep-alive",
		"content-length": "40",
		"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"99\", \"Google Chrome\";v=\"99\"",
		"accept": "application/json, text/plain, */*",
		"content-type": "application/json",
		"sec-ch-ua-mobile": "?0",
		"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36",
		"sec-ch-ua-platform": "\"macOS\"",
		"origin": "http://localhost:3000",
		"sec-fetch-site": "same-origin",
		"sec-fetch-mode": "cors",
		"sec-fetch-dest": "empty",
		"referer": "http://localhost:3000/login",
		"accept-encoding": "gzip, deflate, br",
		"accept-language": "zh-CN,zh;q=0.9,en;q=0.8"
	}
}


export default [
	{
		url: '/api/get',
		method: 'get',
		response: ({ query }) => {
			return {
				code: 0,
				data: {
					name: 'vben',
				},
			}
		},
	},
	{
		url: '/api/post',
		method: 'post',
		timeout: 2000,
		response: {
			code: 0,
			data: {
				name: 'vben',
			},
		},
	},
	{
		url: '/api/test',
		method: 'post',
		timeout: 3000,
		response: (req) => {
			return req
		}
	},
	{
		url: '/api/text',
		method: 'post',
		rawResponse: async (req, res) => {
			let reqbody = ''
			await new Promise((resolve) => {
				req.on('data', (chunk) => {
					reqbody += chunk
				})
				req.on('end', () => resolve(undefined))
			})
			res.setHeader('Content-Type', 'text/plain')
			res.statusCode = 200
			res.end(`hello, ${reqbody}`)
		},
	},
]